using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using Deepcode.Flux.Core.Services.Security;
using Deepcode.Flux.Core.Systems.Audit;


public partial class Public_Notify_errors_NOT_AUTHORISED : System.Web.UI.UserControl
{
	protected void Page_Load(object sender, EventArgs e)
	{
		int UserID = 0;
		string Username = "Unknown user";
		string Email = "";

		AdministrationSecuritySession sess = AdministrationSecurity.GetSession();
		if( sess != null ) 
		{
			UserID = sess.PK_ID;
			Username = sess.RealName;
			Email = sess.Email;
		}

		SystemEvents events = new SystemEvents();
		events.Raise(
			EventSeverity.Critical,
			EventType.Security,
			UserID,
			"Flux",
			"Security Manager",
			"USER ATTEMPTED ACTION THAT THEY ARE NOT AUTHORISED TO CARRY OUT ({0} {1} {2})",
			UserID,
			Username,
			Email);

		AdministrationSecurity.ClearSession();
		if( Deepcode.Flux.Core.Services.Configuration.FluxConfig.Authentication == Deepcode.Flux.Core.Systems.Security.FluxAuthenticationMode.FORMS )
			System.Web.Security.FormsAuthentication.SignOut();
	}
}
